<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><PHP>echo getSysTitle();</PHP></title>
<link href="__CSS__/table.css" rel="stylesheet" type="text/css" />
<script src="__JS__/jquery-1.6.2.min.js"></script>
<script src="__JS__/popup/popup.js"></script>
<script src="__JS__/popup/user.js"></script>
<script>
$(document).ready(function(){
	
	$("#add").bind("click",function(){
		var url="?g=Admin&m=Team&a=add";
		window.location.href=url;
	});
	$("#edit").bind("click",function(){
		var _chekList=[];
		$("input[name='checkData[]']").each(function(){
			if($(this).attr("checked")){
				_chekList.push($(this).val());
			}
		});
		if(_chekList.length<1){
			pAlertN('提示','请选择服务队进行编辑');
			return false;
		}
		if(_chekList.length>1){
			pAlertN('提示','只能选择一个服务队进行编辑');
			return false;
		}
		var url="?g=Admin&m=Team&a=edit&st_id="+_chekList.join('');
		//pDialog("添加用户",url,500,400);
		window.location.href=url;
	});
	$("#del").bind("click",function(){
		
		var _chekList=[];
		$("input[name='checkData[]']").each(function(){
			if($(this).attr("checked")){
				_chekList.push($(this).val());
			}
		});
		if(_chekList.length>0){
			_chekList=_chekList.join(',');
			pConfirm("提示","确认要删除？",_chekList);
		}else{
			pAlertN('提示','请选择服务队');
		}
	});
	$("#lock").bind("click",function(){
		var _chekList=[];
		$("input[name='checkData[]']").each(function(){
			if($(this).attr("checked")){
				_chekList.push($(this).val());
			}
		});
		if(_chekList.length>0){
			_chekList=_chekList.join(',');
			pConfirm("提示","确认要停用？",_chekList,lockCallBack);
		}
	});
	$("#unlock").bind("click",function(){
		var _chekList=[];
		$("input[name='checkData[]']").each(function(){
			if($(this).attr("checked")){
				_chekList.push($(this).val());
			}
		});
		if(_chekList.length>0){
			_chekList=_chekList.join(',');
			pConfirm("提示","确认要启用？",_chekList,unLockCallBack);
		}
	});
	
	$("#allCheckData").bind("click",function(){
		$("input[name='checkData[]']").each(function(){
			if($(this).attr("checked")){
				$(this).removeAttr("checked");
				
			}else{
				$(this).attr("checked",true);
			}
		});
	});
	
	$("#submit").bind("click",function(){
		var _url=window.location.href;
		var _list=_url.split('?');
		var _http=_list[0];
		var _pList=_list[1].split('&');
		var _usePara=[];
		for(var i=0;i<_pList.length;i++ ){
			var _p=_pList[i];
			var _t=_p.split('=')[0];
			if(_t=='g' || _t=='m' || _t=='a'  || _t=='t' || _t=='f1' || _t=='f2'||_t=='upage' /*|| _t=="p"*/){
				_usePara.push(_p);
			}
		}
		if($("#AR_ADDRESS").val()==""){
			$("#AR_ID").val('');
		}
		var _newHttp=_http+"?"+_usePara.join('&');
		
		_newHttp+="&ST_NAME="+encodeURI($("#ST_NAME").val())+"&RP_U_RNAME="+encodeURI($("#RP_U_RNAME").val())+"&AR_ADDRESS="+encodeURI($("#AR_ADDRESS").val())+"&AR_ID="+encodeURI($("#AR_ID").val());
		
		window.location.href=_newHttp;
		
	});
	
	$("#sAr").bind("click",function(){
		var url="?g=Admin&m=Index&a=sarea&f1=AR_ID&f2=AR_ADDRESS";
		openDialog(url);
	});
});
function check(uid,uname){
	var f1="{$f1}";
	var f2="{$f2}";
	if(parent.document.getElementById(f1)){
		parent.document.getElementById(f1).value=uid;
	}
	if(parent.document.getElementById(f2)){
		parent.document.getElementById(f2).value=uname;
	}
	parent.dialogClose();
}
function openDialog(url){
	pDialog('',url,500,380);
}
function dialogClose(){
	pclose();
}

function ShowCallBack(para){
	var pid=para["pid"];
	var url="?g=Admin&m=Team&a=del&st_id="+pid;
	$.ajax({
		   type: "GET",
		   url: url,
		   success: function(msg){
		     if(msg=='y'){
		    	 //pAlertN("提示","删除用户成功");
		    	 alert("删除用户成功");
		    	 window.location.reload();
		     }else{
		    	 //pAlertN("提示","删除用户失败"); 
		    	 alert("删除用户失败");
		     }
		   }
		});
}

function lockCallBack(para){
	var pid=para["pid"];
	var url="?g=Admin&m=Team&a=lock&st_id="+pid+"&lock=1";
	$.ajax({
		   type: "GET",
		   url: url,
		   success: function(msg){
		     if(msg=='y'){
		    	// pAlertN("提示","操作成功");
		    	 alert("操作成功");
		    	 window.location.reload();
		     }else{
		    	// pAlertN("提示","操作失败"); 
		    	 alert("操作失败");
		     }
		   }
		});
}

function unLockCallBack(para){
	var pid=para["pid"];
	var url="?g=Admin&m=Team&a=lock&st_id="+pid+"&lock=0";
	$.ajax({
		   type: "GET",
		   url: url,
		   success: function(msg){
		     if(msg=='y'){
		    	 //pAlertN("提示","操作成功");
		    	 alert("操作成功");
		    	 window.location.reload();
		     }else{
		    	// pAlertN("提示","操作失败"); 
		    	 alert("操作失败");
		     }
		   }
		});
}

function lineDel(u_id){
	pConfirm("提示","确认要删除？",u_id);
}
function lineEdit(u_id){
	var url="?g=Admin&m=Team&a=edit&st_id="+u_id;
	window.location.href=url;
}
function lineLock(u_id){
	pConfirm("提示","确认要停用？",u_id,lockCallBack);
}
function lineUnLock(u_id){
	pConfirm("提示","确认要启用？",u_id,unLockCallBack);
}


</script>
<style>
a {color:#FFFFFF}
.bgcolor{color:#3366CC;cursor:pointer;font-size:12px;}
</style>
</head>

<body>
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
	    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
	      <tr>
	        <td height="24" bgcolor="#353c44">
	        <table width="100%" border="0" cellspacing="0" cellpadding="0">
	          <tr>
	            <td width="8%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
	              <tr>
	                <td width="6%" height="19" valign="bottom"><div align="center"><img src="__PUBLIC__/images/tb.gif" width="14" height="14" /></div></td>
	                <td width="94%" valign="bottom"><span class="STYLE1"> 服务队管理</span></td>
	              </tr>
	            </table></td>
	            <td  width="92%"><div align="right"></div></td>
	          </tr>
	        </table></td>
	      </tr>
	    </table></td>
	  </tr>
  	 
	  <tr>
	  	<td>
	  		<div style="height:20px;border:1px solid #A8C7CE;line-height:20px;padding-left:2px;">
	  			<span class="STYLE1">
	             <img src="__PUBLIC__/images/table/user_add.gif" width="16" height="16" align="absmiddle"/> <span id="add" class="bgcolor">添加 </span>  &nbsp; <img src="__PUBLIC__/images/table/user_edit.gif" width="16" height="16" align="absmiddle"/> <span id="edit" class="bgcolor">编辑</span> &nbsp;&nbsp;<img src="__PUBLIC__/images/table/user_del.gif" width="16" height="16" align="absmiddle"/> <span id="del" class="bgcolor">删除  </span>  &nbsp;&nbsp;<img src="__PUBLIC__/images/table/user_tingyong.gif" width="15" height="15" align="absmiddle"/> <span id="lock" class="bgcolor">停用</span> &nbsp;&nbsp;<img src="__PUBLIC__/images/table/user_kaiqi.gif" width="15" height="15" align="absmiddle"/> <span id="unlock" class="bgcolor">开启</span>   &nbsp;</span><span class="STYLE1"> &nbsp;</span>
	  		</div>
	  	</td>
	  </tr>
	  <tr>
	  	<td align="center">
	  		<form action="" method="post">
		  		<table width="60%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#a8c7ce">
		  			<tr>
		  				<td bgcolor="#FFFFFF"><span class="STYLE10">名称：</span></td>
		  				<td bgcolor="#FFFFFF" >
		  					<input class="searchInput" type="text" name="ST_NAME" id="ST_NAME" value="{$ST_NAME}"></input>
		  				</td>
		  				<td bgcolor="#FFFFFF"><span class="STYLE10">地区：</span></td>
		  				<td bgcolor="#FFFFFF" align="left">
		  					<input class="searchInput" type="text" name="AR_ADDRESS" id="AR_ADDRESS" value="{$AR_ADDRESS}"></input>
		  					<input type="hidden" name="AR_ID" id="AR_ID" value="{$AR_ID}"></input>
		  					<span class="spanButton" id="sAr">&nbsp;查&nbsp;</span>
		  				</td>
		  				<td bgcolor="#FFFFFF"><span class="STYLE10">联系人：</span></td>
		  				<td bgcolor="#FFFFFF">
		  					<input class="searchInput" type="text" name="RP_U_RNAME" id="RP_U_RNAME" value="{$RP_U_RNAME}"></input>
		  				</td>
		  				
		  				<td bgcolor="#FFFFFF">
		  					<input type="button" name="submit" id="submit" value="查询"></input> 
		  				</td>
		  			</tr>
		  		</table>
	  		</form>
	  	</td>
	  </tr>
	  <tr>
	    <td>
	    
	    <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce" >
	      <tr>
	        <th width="4%" height="20" bgcolor="d3eaef" class="STYLE10"><div align="center">
	          <input type="checkbox" id="allCheckData"/>
	        </div></th>
	        <th width="15%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">名称</span></div></th>
	        <th width="15%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">地区</span></div></th>
	        
	        <th width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">联系人</span></div></th>
	        <th width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">手机</span></div></td>
	        <th width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">电话</span></div></td>
	        <th width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">邮箱</span></div></td>
	        <th width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">注册时间</span></div></td>
	        <th width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">是否停用</span></div></td>
	        
	        <th width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">操作</span></div></th>
	      </tr>
	      <volist name="teamList" id="data">
			<tr>
			     <td height="20" bgcolor="#FFFFFF"><div align="center">
		          <input type="checkbox" name="checkData[]" id="checkData_{$data.ST_ID}" value="{$data.ST_ID}" />
		        </div></td>
		        <td height="20" bgcolor="#FFFFFF" class="STYLE6"><div align="center"><span class="STYLE19">{$data.ST_NAME}</span></div></td>
		        <td height="20" bgcolor="#FFFFFF" class="STYLE6"><div align="center"><span class="STYLE19">{$data.ST_AREA}</span></div></td>
		        <td height="20" bgcolor="#FFFFFF" class="STYLE6"><div align="center"><span class="STYLE19">{$data.RP_U_RNAME}</span></div></td>
		        <td height="20" bgcolor="#FFFFFF" class="STYLE6"><div align="center"><span class="STYLE19">{$data.ST_MOBILE}</span></div></td>
		        <td height="20" bgcolor="#FFFFFF" class="STYLE6"><div align="center"><span class="STYLE19">{$data.ST_PHONE}</span></div></td>
		        <td height="20" bgcolor="#FFFFFF" class="STYLE6"><div align="center"><span class="STYLE19">{$data.ST_EMAIL}</span></div></td>
		        <td height="20" bgcolor="#FFFFFF" class="STYLE6"><div align="center"><span class="STYLE19">{$data.CREATED_AT}</span></div></td>
		        <td height="20" bgcolor="#FFFFFF" class="STYLE19"><div align="center">
		        <if condition="$data.IS_BLOCK eq 1">
		        	停用
		        <else/>
		        	正常
		        </if>
		        </div></td>
		        <td height="20" bgcolor="#FFFFFF"><div align="center" class="STYLE21"><a href="#" onclick="lineDel('{$data.ST_ID}');return false;">删除</a> | <a href="?g=Admin&m=Team&a=edit&st_id={$data.ST_ID}" onclick="">编辑</a></div></td>
	      	</tr>
	      </volist>
	    </table>
	    
	    </td>
	  </tr>
	  <tr>
	  	<td height="20" bgcolor="#FFFFFF" class="pageToolbar" align="left">
	  	<php>
  	echo getPageList();
  	</php>
	  		&nbsp;&nbsp;
	  	{$page}</td>
	  </tr>
    </table>

</body>
</html>
